layui.use([ 'dtree' ], function() {

	var form = layui.form;
	var dtree = layui.dtree;

	$("#deptAddType").initSelectDict();

	// 获取父级菜单
	var deptTree = dtree.renderSelect({
		elem : "#deptTree",
		width : "100%",
		dataStyle : "layuiStyle",
		dataFormat : "list",
		response : {
			message : "msg",
			statusCode : 200
		},
		url : ctx + "/sys/dept/getDtreeList",
		method: "get"
	});

	layui.form.on('submit(add-form)', function(data) {
		var param = dtree.getNowParam(deptTree);
		data.field.parentId = param.nodeId;
		ajaxCommit({
			url : ctx + "/sys/dept/add",
			data : data.field,
			successfunc : function(){ pageReload() }
		})
		return false;
	});
	
})